﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using Century.Web.Security.Attributes;
using EnterpriseLibrary.Globalization;

namespace Century.Web.MVC.AdminArea
{
    public class InlineEditingController : Controller
    {
        #region [ Label ]

        [Authorization(Group = "", Name = "InlineEditing")]
        public string UpdateLabel(string key, string value)
        {
            GlobalizationManager.CMSUpdateTranslation(string.Empty, key, value);
            return value;
        }

        #endregion

        #region [ Position ]

        //public bool ChangeOrder(int pageId, int holderId, Dictionary<int, int> partId_orderId)
        //{
        //    return true;
        //}


        #region [ Html Position ]

        //public JsonResult AddStaticContent(int pageId, int holderId)
        //{
        //    ContentHolderPart part = PersistDataUpdater.AddStaticContent(pageId, holderId);
        //    return Json(new { key = part.StaticContentId, ordid = part.PartOrder, partid = part.Id });
        //}


        //public bool RemovePart(int pageId, int partId)
        //{
        //    return PersistDataUpdater.RemovePart(pageId, partId);
        //}

        //[Authorization(Group = "", Name = "InlineEditing")]
        //public string UpdateStaticContent(string key, string value, string pageId)
        //{
        //    PersistDataUpdater.UpdateStaticContent(int.Parse(key), value, int.Parse(pageId));
        //    return value;
        //}

        #endregion

        #region [ View Position ]

        //public ActionResult DynamicContentSelector(int pageId, int holderId)
        //{
        //    ViewBag.HolderId = holderId;
        //    ViewBag.PageId = pageId;
        //    using (DynamicContentBSO db = new DynamicContentBSO())
        //    {
        //        return View(db.GetList());
        //    }
        //}

        //[HttpPost]
        //public bool DynamicContentSelect(int id, int holderId, int pageId)
        //{
        //    using (DynamicContentBSO db = new DynamicContentBSO())
        //    {
        //        return db.AddViewToPosition(id, holderId, pageId);
        //    }
        //}

        //public JsonResult AddDynamicContent(int pageId, int holderId, int viewId)
        //{

        //    ContentHolderPart part = PersistDataUpdater.AddDymamicContent(pageId, holderId, viewId);
        //    // var v = new ViewContext();
        //    //var h = new HtmlHelper(v, new ViewPage());
        //    //ControllerContext.HttpContext
        //    //ControllerContext, part.DynamicContent.ActionName, part.DynamicContent.ControllerName, new { area = part.DynamicContent.AreaName });
        //    //PartialRequest pr = new PartialRequest(new
        //    // {
        //    //     controller = part.DynamicContent.ControllerName,
        //    //     action = part.DynamicContent.ActionName,
        //    //     area = part.DynamicContent.AreaName
        //    // });

        //    return Json(new
        //    {
        //        key = part.DynamicContentId,
        //        ordid = part.PartOrder,
        //        partid = part.Id
        //        ,
        //        view = part.DynamicContent.AreaName + "/" + part.DynamicContent.ControllerName + "/" + part.DynamicContent.ActionName
        //    });
        //}

        #endregion

        #endregion

        public ActionResult InlineEditingHeaderScripts()
        {
            return View();
        }

        public ActionResult InlineEditingBodyHtml()
        {
            return View();
        }
    }
}
